package com.carkeeper.controller;


import com.carkeeper.pojo.BlogCategory;
import com.carkeeper.service.BlogCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping(value = {"/blogCategory"})
public class BlogCategoryController {

    @Autowired
    private BlogCategoryService blogCategoryService;

    @PostMapping
    public String addCategory(@RequestBody BlogCategory blogCategory) {
        return blogCategoryService.addCategory(blogCategory);
    }

    @DeleteMapping
    public String deleteCategory(long id) {
        return blogCategoryService.deleteCategory(id);
    }

    @PutMapping
    public Boolean updateCategory(@RequestBody BlogCategory blogCategory) {
        return blogCategoryService.updateCategory(blogCategory);
    }

    @GetMapping
    public List<BlogCategory> queryAll(@RequestParam(required = false) String conditionJson) {
        
        return blogCategoryService.queryAll();
    }
}
